﻿
using FacebookXmpp.Parse;

namespace FacebookXmpp.Stanzas
{
	internal class StartTls : Stanza
	{
		public StartTls()
		{
			NextResponse = @"<starttls xmlns=""urn:ietf:params:xml:ns:xmpp-tls"" />";
		}

		internal override StanzaListenCriteria ListenFor
		{
			get { return new StanzaListenCriteria("proceed", true); }
		}

        public override void ProcessResponse(MessageData recieved)
		{
			Stream.RemoveHandler( this );
			Stream.AddHandler( new StreamStream( ) );
            Stream.Dashboard.WorkerState("Begin Secure Mode");
			Stream.StartTls();			
		}
	}
}
